#ifndef __graph_H__
#define __graph_H__

#define Default_Vertex_Size 15
#define datatypeG char

typedef struct Edge
{
	int dest;
	struct Edge *link;
} Edge;

typedef struct Vertex
{
	datatypeG data;
	Edge *adj;
} Vertex;

typedef struct Graph
{
	int MaxVertex;
	int NumVertex;
	int NumEdge;
	Vertex *NodeTable;
} Graph;

int Init(Graph *graph);

int InsertVertex(Graph *graph,datatypeG data);

int InsertEdge(Graph *graph,datatypeG vertex1,datatypeG vertex2);

int GetVertexPosion(Graph *graph,datatypeG vertex);

void Show(Graph * graph);

int RemoveEdge(Graph * graph,datatypeG vertex1,datatypeG vertex2);

int RemoveVertex(Graph * graph,datatypeG vertex);

void Destory(Graph *graph);

int GetFirstNeighbor(Graph *graph,datatypeG vertex);

int GetNextNeighbor(Graph *graph,datatypeG vertex1,datatypeG vertex2);

datatypeG GetVertexValue(Graph *graph, int p);
//==========================================================================
int DFS(Graph *graph, datatypeG vertex);

void DFS_(Graph *graph, int p, int visited[]);

int BFS(Graph *graph,datatypeG vertex);
//=========================================================================
int Connection(Graph *graph);  //非连通图的遍历

#endif
